home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / comm / tcp / TCPHelp112NoLb.lha / nntptransfer < prev   
AmigaDOS Script File  |  1995-03-26  |  3KB  |  77 lines

  1. .KEY HOST,GROUPS/K,HISTORY/K,STAMP/K,KILL/K,TO/K,PANIC/K,BATCH/K/N,BLIP/K/N,TRACE/K
  2. ;*
  3. ;*   Sample script to invoke nntp client and add news to uucp Newsbase
  4. ;*
  5. ;*  Mandatory parameter of name of news server; all other parameters have
  6. ;*  reasonable defaults (assuming you have a uulib:NewsGroups file).
  7. ;*
  8. .def HOST news.demon.co.uk        ;for Demon subscribers only !
  9. .def GROUPS "UULIB:NewsGroups"        ;file containing list of groups
  10. .def HISTORY "AmiTCP:db/NewsHistory"    ;file containing news history
  11. .def STAMP "AmiTCP:db/NewsStamp"    ;file containing date news last retrieved
  12. .def KILL "AmiTCP:db/nntpKillFile"    ;file containing kill instructions
  13. .def BLIP 5                ;frequency of display of blipmsg
  14. .def TO "uuspool:NewsBatch"        ;file to contain batched news
  15. .def PANIC 3000000            ;maximum size of pending news in T:
  16. .def BATCH 3                ;maximum number of requests batched to server
  17. .def TRACE 5                ;amount of information displayed (used to be 5)
  18. .BRA {
  19. .KET }
  20.  
  21. if NOT EXISTS {Groups}            ;Check we have a Groups file
  22.     echo "You must set up a '{Groups}' file, or give the name"
  23.     echo "of another file containing the news groups you want"
  24.     quit 10
  25. endif
  26.  
  27. if NOT {Host} eq localhost
  28.     if NOT {Host} eq $HostName
  29.         if NOT {Host} eq $NodeName
  30.             if NOT $Slip0State eq Online
  31.                 echo "NNTPTransfer: Not connected."
  32.                 quit 10
  33.                 endif
  34.             endif
  35.         endif
  36.     endif
  37. endif
  38.  
  39. echo "Pulling News..."
  40.  
  41. echo >t:nntpclient-Commands "NEWGROUPS t:nntp-NewGroups*NNEWNEWS {Groups} {to}"
  42.  
  43. failat 16                ;nntpclient has done something at error level 10
  44. Amitcp:bin/nntpclient <t:nntpclient-Commands {host} COMPLEX BATCH {batch} BLIP {blip} BLIPMSG "%5ld articles received" HISTORYFILE {history} STAMPFILE {stamp} TRACE {trace}
  45. if $RC EQ 15
  46.     wait 2
  47.     echo "Trying ... "{HOST}
  48.     amitcp:bin/nntptransfer {HOST}
  49.     quit
  50. endif
  51. ;type t:nntpclient-Commands         ;diagnostic - commented out
  52. failat 15                ;back to default
  53. delete t:nntpclient-Commands QUIET    ;don't want command file now
  54.  
  55. if exists t:nntp-NewGroups        ;Got any new groups ?
  56.     echo "{host} has the following new news groups:"
  57.     echo
  58.     type t:nntp-NewGroups        ; Show new groups
  59.     delete t:nntp-NewGroups    quiet    ; and get rid of the file
  60. endif
  61.  
  62. if exists {to}
  63.     failat 30            ;don't worry if we can't find GetPriority
  64.     amitcp:bin/getpriority >nil:        ;preserve the current priority in a local variable
  65.     failat 20            ;back to default
  66.     changetaskpri -4        ;postprocessing is a background task
  67. ;    rnews {to}            ;postprocess news to uucp news base
  68. ;    failat 10                ; because
  69. ;    delete {to} quiet        ;get rid of the postprocessed file
  70.     get >nil: Priority        ;check that Priority local var. was set
  71.     if not WARN
  72.         changetaskpri $Priority ;re-instate the saved priority
  73.     endif
  74. else
  75.     echo "Sorry, no news transferred"
  76. endif
  77.